From 87749d217e40d5aa785ced258c260aac6ab79ae9 Mon Sep 17 00:00:00 2001 From: Liam Date: Sun, 19 Feb 2023 15:29:42 -0500 Subject: cheat_engine: add check for hid initialization --- src/core/memory/cheat_engine.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/memory/cheat_engine.cpp b/src/core/memory/cheat_engine.cpp index 44ee39648..c2d96bbec 100644 --- a/src/core/memory/cheat_engine.cpp +++ b/src/core/memory/cheat_engine.cpp @@ -47,8 +47,13 @@ void StandardVmCallbacks::MemoryWrite(VAddr address, const void* data, u64 size) } u64 StandardVmCallbacks::HidKeysDown() { - const auto applet_resource = - system.ServiceManager().GetService("hid")->GetAppletResource(); + const auto hid = system.ServiceManager().GetService("hid"); + if (hid == nullptr) { + LOG_WARNING(CheatEngine, "Attempted to read input state, but hid is not initialized!"); + return 0; + } + + const auto applet_resource = hid->GetAppletResource(); if (applet_resource == nullptr) { LOG_WARNING(CheatEngine, "Attempted to read input state, but applet resource is not initialized!"); -- cgit v1.2.3